//
//  HBEmotion.swift
//  sinaWeibo
//
//  Created by Beans on 16/7/2.
//  Copyright © 2016年 iceWorks. All rights reserved.
//

import UIKit

class HBEmotion: NSObject {

    // com.apple.emoji中 所对应编码
    var code: String? {
        didSet {
            // 16进制 -> Character

//            let code = "0x1f603"
            // 创建一个NSScanner
            let scanner = NSScanner(string: code!)
            // 定义一个UInt32类型的变量,用于接收扫描返回的数据
            var result: UInt32 = 0
            scanner.scanHexInt(&result)
            // 把result 转换成Unicode
            let unicode = UnicodeScalar(result)
            // 把unicdoe转换成Character
            let character = Character(unicode)

            emoji = "\(character)"
        }
    }

    // 单独定义一个属性, 存储处理过的emoji
    var emoji: String?

    // com.sina.default/lxh中
    // 上传服务器发送表情
    var chs: String?
    // 记录图片名字
    var png: String?
    // 记录图片所对应的包路径
    var path: String?

    init(dict: [String: AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
    }
}
